package org.cbg.control;

import org.cbg.bean.SearchGoodsResultBean;
import org.cbg.frame.TrslationMainJframe;
import org.cbg.panel.TraslationMyMainCardJpanel;
import org.cbg.until.TraslationTableUntil;
import org.come.action.FromServerAction;
import org.come.until.GsonUtil;

/**
 * 藏宝阁指定购买类回调
 * 
 * @author Administrator
 * 
 */
public class SearchDesignatedPurchaseResultControl implements FromServerAction {

    @Override
    public void controlMessFromServer(String mes, String type) {
        // TODO Auto-generated method stub

        // 消息处理部分(转换为对应的类)
        SearchGoodsResultBean sa = GsonUtil.getGsonUtil().getgson().fromJson(mes, SearchGoodsResultBean.class);

        // sa.getMessages()s
        /**
         * 重绘消息面板内容 最大页数赋值
         */
        TraslationMyMainCardJpanel traslationMyMainCardJpanel = TrslationMainJframe.getTrslationMainJframe().getTrslationMainJpanel().getTranslationMainCardJpanel().getTraslationMyMainJpanel().getTraslationMyMainCardJpanel();
        TraslationTableUntil.setTableModel(traslationMyMainCardJpanel.getTraslationMyMainZhidinggoumaiJpanel()
                .getjScrollPane(), sa.getSalegoods(), TrslationMainJframe.getTrslationMainJframe()
                .getShoucangWupinList());
        traslationMyMainCardJpanel.getTraslationMyMainZhidinggoumaiJpanel().setPage(
                sa.getTotal() == 0 ? 1 : sa.getTotal());
        /**
         * 展示当前对应面板
         */
        traslationMyMainCardJpanel.getCardLayout()
                .show(traslationMyMainCardJpanel, "zhidinggoumai");

    }

}
